import os
import glob
os.system('rm -rf *.image')
fitslist=glob.glob('*.fits')

for fitsimage in fitslist:
   if os.path.exists(fitsimage.replace('.fits','')):
      continue
   else:
      importfits(fitsimage=fitsimage,imagename=fitsimage.replace('.fits',''))

